// ignore_for_file: prefer_typing_uninitialized_variables

import 'package:flutter/cupertino.dart';

class ShowImageSheetWidget extends StatefulWidget {
  const ShowImageSheetWidget(
      {Key? key, this.confirmCallback, required this.canPhoto})
      : super(key: key);
  final confirmCallback;
  final bool canPhoto;
  @override
  State<ShowImageSheetWidget> createState() => _ShowImageSheetWidgetState();
}

class _ShowImageSheetWidgetState extends State<ShowImageSheetWidget> {
  @override
  Widget build(BuildContext context) {
    return CupertinoActionSheet(
      actions: <Widget>[
        widget.canPhoto == true
            ? CupertinoActionSheetAction(
                onPressed: () {
                  Navigator.pop(context);
                  widget.confirmCallback('拍照');
                },
                child: const Text(
                  '拍照',
                  style: TextStyle(fontSize: 16, color: Color(0xFF333333)),
                ),
              )
            : Container(),
        CupertinoActionSheetAction(
          onPressed: () {
            Navigator.pop(context);
            widget.confirmCallback('从手机相册选择');
          },
          child: const Text('从手机相册选择',
              style: TextStyle(fontSize: 16, color: Color(0xFF333333))),
        ),
      ],
      cancelButton: CupertinoActionSheetAction(
        onPressed: () {
          Navigator.pop(context);
        },
        child: const Text(
          '取消',
          style: TextStyle(fontSize: 16, color: Color(0xFF333333)),
        ),
      ),
    );
  }
}
